AgarAI

How to Play


The objective of the game is to get as many pellets as you can!

The small dots on the screen that appear and disappear when an agent touches them, are called "pellets" and these determine the score each agent has.
You are the green circle and you can move your player around with the WASD or arrow keys.

There are three AIs of different colors.

  • Red is a random walk ai, which will randomly choose a direction (or stop in place) and move in that direction every second or so.
  • Blue is the greedy ai, which will choose the pellet that it is closest to, and walk towards it.
  • Orange is a "gravity" ai, instead of walking towards a pellet, it pulls the pellet towards it like gravity.
Feel free to refresh the page to start over again!

What is this?


At the heart of this game is the agents competition for the pellets. As you gain pellets the size of your circle gets larger. And whoever has the most pellets "wins".

This game is a close cousin of the game "Agar.io" where multiple people online would be like these agents and they fight over the small pellets in order to be the biggest circle (largest radius) in the environment. Where agents can grow either by picking up pellets, or by swallowing up other players to grow massive and be the "king" of the field.

Why did I learn & Why did I make this?


I've never created an interactive web-application before, so I wanted to see if I could develop a game (which was something I'm more familiar with). I had worked with Java, and the very old (and mostly defunct) Java GUI to create '5-card-stud', but after watching some Youtube, the channel "coding-train" was recommended to me. "Coding-Train" is a Youtube Channel that hosts tutorials/courses taught by Daniel Shiffman— a professor at the Interactive Telecommunications Program in New York— on just about anything to do with programming, from fun games, to understand the deeper mechanics behind APIs and Machine Learning.

He led me on a journey to learn Javascript for the first time. From basic syntax, to "syntactical sugar" like filter() and reduce(). Then from there, he went on to create wonderful visualizations of natural phenomena through his "The Nature of Coding" series. Which then introduced me to p5, a Processing Javascript/Java library which allowed for very easy graphics rendering.

Thanks so much for reading!